import javax.swing.*;
import java.awt.*;

public class MyPanel extends JPanel {
    public MyPanel() {

        add(new JLabel("["));
        add(new JButton("点我"));
        add(new JLabel("]"));


    }
}

class Test{

    public static void main(String[] args) {
        JFrame jFrame = new JFrame("测试第三级组件");
        jFrame.setLocation(300,400);
        jFrame.setSize(400,400);
        jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        jFrame.setLocationRelativeTo(null);
        jFrame.setLayout(new FlowLayout());

        MyPanel myPanel = new MyPanel();
        jFrame.add(myPanel);
        jFrame.setVisible(true);
    }

}
